<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Adding a new GIMPLE statement code (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Adding a new GIMPLE statement code (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Adding a new GIMPLE statement code (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GIMPLE.html" rel="up" title="GIMPLE">
<link href="Statement-and-operand-traversals.html" rel="next" title="Statement and operand traversals">
<link href="Sequence-iterators.html" rel="prev" title="Sequence iterators">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="section-level-extent" id="Adding-a-new-GIMPLE-statement-code">
<div class="nav-panel">
<p>
Next: <a href="Statement-and-operand-traversals.html" accesskey="n" rel="next">Statement and operand traversals</a>, Previous: <a href="Sequence-iterators.html" accesskey="p" rel="prev">Sequence iterators</a>, Up: <a href="GIMPLE.html" accesskey="u" rel="up">GIMPLE</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Adding-a-new-GIMPLE-statement-code-1"><span>12.11 Adding a new GIMPLE statement code<a class="copiable-link" href="#Adding-a-new-GIMPLE-statement-code-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Adding-a-new-GIMPLE-statement-code"></a>

<p>The first step in adding a new GIMPLE statement code, is
modifying the file <code class="code">gimple.def</code>, which contains all the GIMPLE
codes.  Then you must add a corresponding gimple subclass
located in <code class="code">gimple.h</code>.  This in turn, will require you to add a
corresponding <code class="code">GTY</code> tag in <code class="code">gsstruct.def</code>, and code to handle
this tag in <code class="code">gss_for_code</code> which is located in <code class="code">gimple.cc</code>.
</p>
<p>In order for the garbage collector to know the size of the
structure you created in <code class="code">gimple.h</code>, you need to add a case to
handle your new GIMPLE statement in <code class="code">gimple_size</code> which is located
in <code class="code">gimple.cc</code>.
</p>
<p>You will probably want to create a function to build the new
gimple statement in <code class="code">gimple.cc</code>.  The function should be called
<code class="code">gimple_build_<var class="var">new-tuple-name</var></code>, and should return the new tuple
as a pointer to the appropriate gimple subclass.
</p>
<p>If your new statement requires accessors for any members or
operands it may have, put simple inline accessors in
<code class="code">gimple.h</code> and any non-trivial accessors in <code class="code">gimple.cc</code> with a
corresponding prototype in <code class="code">gimple.h</code>.
</p>
<p>You should add the new statement subclass to the class hierarchy diagram
in <code class="code">gimple.texi</code>.
</p>

</div>



</body>
</html>
